<?php

declare(strict_types=1);

namespace App\CustHub\Request;

use Mine\MineFormRequest;

class ServerRequest extends MineFormRequest
{
    /**
     * 公共规则.
     */
    public function commonRules(): array
    {
        return [];
    }

    /**
     * 新增数据验证规则
     * return array.
     */
    public function saveRules(): array
    {
        return [
            'ip' => 'required|max:200',
            'region' => 'required|max:200',
            'status' => 'required|in:0,1',
            'type' => 'required|in:0,1',
        ];
    }

    /**
     * 更新数据验证规则
     * return array.
     */
    public function updateRules(): array
    {
        return [
            'ip' => 'required|max:200',
            'status' => 'required|in:0,1',
            'type' => 'required|in:0,1',
        ];
    }

    /**
     * 修改状态数据验证规则
     * return array.
     */
    public function changeStatusRules(): array
    {
        return [
            'id' => 'required|integer',
            'status' => 'required|in:0,1',
        ];
    }

    /**
     * 字段映射名称
     * return array.
     */
    public function attributes(): array
    {
        return [
            'id' => '服务器ID',
            'name' => '服务器名称',
            'ip' => 'IP地址',
            'province' => '所属省份',
            'city' => '所属城市',
            'pro_code' => '省份代码',
            'city_code' => '城市代码',
            'count' => '机器人数量',
            'status' => '服务器状态',
            'server_status' => '服务器是否可用',
            'max_count' => '机器人数量限制',
            'client_type' => '渠道',
            'login_count' => '在线个数',
            'type' => '服务器类型',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
        ];
    }
}